// Benke PDF. C6 p25.

#include <stdio.h>
#include <math.h>

int main()
{
    double x0, x1, a;
    printf("Please input number a: ");
    scanf("%lf", &a);
    x0 = a / 2;
    x1 = 0.5 * (x0 + a / x0);
    while (fabs(x1 - x0) > 1e-5)
    {
        x0 = x1;
        x1 = 0.5 * (x0 + a / x0);
    }
    printf("\nSqrt(a) is: %lf\n", x1);
    return 0;
}